package com.charlotte.study.gupao.proxy.dynamicproxy.jdkproxy;

import sun.misc.ProxyGenerator;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Proxy;

/**
 * @author junjie.ding
 * @date 2020/3/3
 */
public class main {
    public static void main(String[] args) throws IOException {
        JdkMeipo meipo = new JdkMeipo();
        IPerson instance = meipo.getInstance(new Zhangsan());
        instance.findLove();

        byte[] generateProxyClass = ProxyGenerator.generateProxyClass("$proxy0", new Class[]{IPerson.class});

        FileOutputStream fos = new FileOutputStream("D:\\download\\gupaoedu-vip-pattern-proxy\\gupaoedu-vip-pattern-proxy\\src\\main\\java\\com\\gupaoedu\\vip\\pattern\\proxy\\dbroute\\$proxy0.class");

        fos.write(generateProxyClass);
        fos.flush();
        fos.close();

    }
}
